This chapter will show you how to setup the container quota in the Rackspace for your backup users to backup on Rackspace storage container.
If you are new to Rackspace, you should check with their documentation on general setup available at http://support.rackspace.com/
If you have tried Rackspace before, you can follow our steps to setup the storage for your backup users. Our steps will guide you to complete the followings:
After you have completed these steps, the container quota can be set.
Before setting up storage quota in the steps below, we assumed that the storage has already created on your Rackspace by the backup client. The name of the container is named in the following syntax eg:"mybackup-<username>".
Collect your users' API key from the "User Management" > "Username" (Click on the user name that you need to get the API key.) > "Login Details" > "API Key"
Click on "Show" to display the masked key.
Connect to a Linux machine with the curl package. To obtain the access token, you need to use the curl command to post the request to the Rackspace server.
Usage: curl -v -k -s https://identity.api.rackspacecloud.com/v2.0/tokens -X "POST" -d "{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"<user name>\", \"apiKey\":\"<API Key>\"}}}" -H "Content-Type: application/json"
Note: The API key can be collected from previous step.
---------------------------------------------------------------------------------------------------- [root@os ~]# curl -v -k -s https://identity.api.rackspacecloud.com/v2.0/tokens - X "POST" -d "{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"DavidCha n\", \"apiKey\":\"778b2d84b63334e36a2d841339663446\"}}}" -H "Content-Type: appli cation/json" * About to connect() to identity.api.rackspacecloud.com port 443 (#0) * Trying 72.3.138.129... connected * Connected to identity.api.rackspacecloud.com (72.3.138.129) port 443 (#0) : : : Trimmed : : : {"access":{"token":{"id":"e85127fa63824a9f85ba437d1061b5c0","expires":"2014-11-1 8T07:26:16.071Z","tenant":{"id":"926819","name":"926819"},"RAX-AUTH:authenticate dBy":["APIKEY"]},"serviceCatalog":[{"name":"cloudFilesCDN","endpoints":{"region" :"HKG","tenantId":"MossoCloudFS_926819","publicURL":"https:\/\/cdn6.clouddrive.c om\/v1\/MossoCloudFS_926819"},{"region":"SYD","tenantId":"MossoCloudFS_926819"," publicURL":"https:\/\/cdn4.clouddrive.com\/v1\/MossoCloudFS_926819"},{"region":" DFW","tenantId":"MossoCloudFS_926819","publicURL":"https:\/\/cdn1.clouddrive.com \/v1\/MossoCloudFS_926819"},{"region":"IAD","tenantId":"MossoCloudFS_926819","pu blicURL":"https:\/\/cdn5.clouddrive.com\/v1\/MossoCloudFS_926819"},{"region":"OR D","tenantId":"MossoCloudFS_926819","publicURL":"https:\/\/cdn2.clouddrive.com\/ v1\/MossoCloudFS_926819"}],"type":"rax:object-cdn"},{"name":"cloudFiles","endpoi nts":[{"region":"HKG","tenantId":"MossoCloudFS_926819","publicURL":"https:\/\/st orage101.hkg1.clouddrive.com\/v1\/MossoCloudFS_926819","internalURL":"https:\/\/ snet-storage101.hkg1.clouddrive.com\/v1\/MossoCloudFS_926819"}, : : : Trimmed : : : "user":{"id":"0c3001f01cb94856a87f8653ab875117","roles":[{"id":"10000256","descr iption":"Object Store Admin Role for Account User","name":"object-store:admin"}, {"tenant* Connection #0 to host identity.api.rackspacecloud.com left intact * Cl osing connection #0 Id":"926819","id":"6","description":"A Role that allows a us er access to keystone Service methods","name":"compute:default"},{"tenantId":"Mo ssoCloudFS_926819","id":"5","description":"A Role that allows a user access to k eystone Service methods","name":"object-store:default"},{"id":"2","description": "Default Role.","name":"identity:default"}],"name":"DavidChan","RAX-AUTH:default Region":"HKG"}}}[root@os ~]# [root@os ~]# ----------------------------------------------------------------------------------------------------
The above highlighted value is required to collect before you can submit another curl command to set the quota. As the returned string is long with scattered information, you can also use third party parser eg: JSON viewer to interpret the above string.
Note:
The above example is trimmed to fit into this document.
If you are using the JSON viewer, you need to copy the following string
{"access":{"token ......Trimmed...... defaultRegion":"HKG"}}}, and show it in the JSON viewer.
To configure the quota, you need to extract the following 3 pieces of information from the string returned from the previous step.
and collect the container name from the Rackspace Cloud Control Panel.
3.1 token id
The token id can be collected in the token object.
e.g. e85127fa63824a9f85ba437d1051b5c0
---------------------------------------------------------------------------------------------------- : : : {"access":{"token":{"id":"e85127fa63824a9f85ba437d1061b5c0","expires":"2014-11-1 8T07:26:16.071Z","tenant":{"id":"926819","name":"926819"},"RAX-AUTH:authenticate dBy":["APIKEY"]} : : : ----------------------------------------------------------------------------------------------------
From JSON Viewer:
3.2 RAX-AUTH:defaultRegion
The default region can be collected in the user object.
e.g. HKG
---------------------------------------------------------------------------------------------------- : : : "user":{"id":"0c3001f01cb94856a87f8653ab875117","roles":[{"id":"10000256","descr iption":"Object Store Admin Role for Account User","name":"object-store:admin"}, {"tenant* Connection #0 to host identity.api.rackspacecloud.com left intact * Cl osing connection #0 Id":"926819","id":"6","description":"A Role that allows a us er access to keystone Service methods","name":"compute:default"},"tenantId":"Mos soCloudFS_926819","id":"5","description":"A Role that allows a user access to ke ystone Service methods","name":"object-store:default"},{"id":"2","description":" Default Role.","name":"identity:default"}],"name":"DavidChan","RAX-AUTH:defaultR egion":"HKG"}} : : : ----------------------------------------------------------------------------------------------------
From JSON Viewer:
3.3 endpoints public URL
You need to find the endpoints public URL from serviceCatalog object, with the sub-object name called "cloudFiles", search inside the endpoint with your default region (e.g. HKG), then you can find the public URL path.
e.g. https://storage101.hkg1.clouddrive.com/v1/MossoCloudFS_926819
---------------------------------------------------------------------------------------------------- : : : "serviceCatalog":[{"name":"cloudFilesCDN","endpoints":[{"region":"HKG","tenantId ":"MossoCloudFS_926819","publicURL":"https:\/\/cdn6.clouddrive.com\/v1\/MossoClo udFS_926819"},{"region":"SYD","tenantId":"MossoCloudFS_926819","publicURL":"http s:\/\/cdn4.clouddrive.com\/v1\/MossoCloudFS_926819"},{"region":"DFW","tenantId": "MossoCloudFS_926819","publicURL":"https:\/\/cdn1.clouddrive.com\/v1\/MossoCloud FS_926819"},{"region":"IAD","tenantId":"MossoCloudFS_926819","publicURL":"https: \/\/cdn5.clouddrive.com\/v1\/MossoCloudFS_926819"},{"region":"ORD","tenantId":"M ossoCloudFS_926819","publicURL":"https:\/\/cdn2.clouddrive.com\/v1\/MossoCloudFS _926819"}],"type":"rax:object-cdn"},{"name":"cloudFiles","endpoints":[{"region": "HKG","tenantId":"MossoCloudFS_926819","publicURL":"https:\/\/storage101.hkg1.cl ouddrive.com\/v1\/MossoCloudFS_926819","internalURL":"https:\/\/snet-storage101. hkg1.clouddrive.com\/v1\/MossoCloudFS_926819"}, : : : ----------------------------------------------------------------------------------------------------
From JSON Viewer:
3.4 Container name
After the backup set is created in the backup client, the container name can be found in the "Files" tag in the Rackspace Cloud Control Panel
eg: mybackup-davidchan
In this example, we will set the quota of the container to 2MB (2097152 bytes).
Usage: curl -v -k -X PUT -H "X-Container-Meta-Quota-Bytes: <quota>" -H "X-Auth-Token: <token id>" <endpoints public URL>/<container name>
Note:
The Rackspace container URL is the endpoints public URL and the container name that was created for your user, which is
https://storage101.hkg1.clouddrive.com/v1/MossoCloudFS_926819 and mybackup-davidchan
You need to put a slash "/" in between the 2 values.
Eg: https://storage101.hkg1.clouddrive.com/v1/MossoCloudFS_926819/mybackup-davidchan
---------------------------------------------------------------------------------------------------- [root@os ~]# curl -v -k -X PUT -H "X-Container-Meta-Quota-Bytes: 2097152" -H "X- Auth-Token: e85127fa63824a9f85ba437d1061b5c0" https://storage101.hkg1.clouddrive .com/v1/MossoCloudFS_926819/mybackup-davidchan * About to connect() to storage101.hkg1.clouddrive.com port 443 (#0) * Trying 119.9.64.232... connected * Connected to storage101.hkg1.clouddrive.com (119.9.64.232) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * warning: ignoring value of ssl.verifyhost * skipping SSL peer certificate verification * SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA * Server certificate: * subject: CN=storage101.hkg1.clouddrive.com,OU=Domain Validated,OU=Thawte SSL123 certificate,OU=Go to https://www.thawte.com/repository/index.html * start date: Aug 15 00:00:00 2013 GMT * expire date: Aug 15 23:59:59 2015 GMT * common name: storage101.hkg1.clouddrive.com * issuer: CN=Thawte DV SSL CA,OU=Domain Validated SSL,O="Thawte, Inc.",C=U S > PUT /v1/MossoCloudFS_926819/mybackup-davidchan HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zl ib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: storage101.hkg1.clouddrive.com > Accept: */* > X-Container-Meta-Quota-Bytes: 2097152 > X-Auth-Token: e85127fa63824a9f85ba437d1061b5c0 > < HTTP/1.1 202 Accepted < Content-Length: 76 < Content-Type: text/html; charset=UTF-8 < X-Trans-Id: tx682827faeba84b3bba3ee-005469b15ahkg1 < Date: Mon, 17 Nov 2014 08:27:06 GMT < * Connection #0 to host storage101.hkg1.clouddrive.com left intact * Closing connection #0 <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>[roo t@os ~]# [root@os ~]# ----------------------------------------------------------------------------------------------------
When you see the "Accepted" message returned, the 2MB quota is set successfully.